<?php

function win_observation_browse_records() {
  $path = drupal_get_path('module','win_observation');
  drupal_add_js($path . '/js/external/jquery-1.3.2.js');
  drupal_add_js($path . '/js/external/jquery.dataTables.js');
  drupal_add_js($path . '/js/search_results_page.js');

  drupal_add_css($path . '/css/jquery-ui.css');
  drupal_add_css($path . '/css/jquery.datatable/css/demo_table.css');

  $query = 'select id from win_observations where id in (select observation_id from win_validation where status = 1)';
  $result = db_query($query);
  if (!$result) {
    return 'Error talking to database. Please try after sometime.';
  }
  else {
    $oids = array();
    while ($obj = db_fetch_object($result)) {
      $oids[] = $obj->id;
    }
    
    $observations = get_observation_info_for_search_results($oids);
    return show_search_results($observations);
  }
}